<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg">
  <head>
    <title>Formatted Output (Common-Lisp-style)</title>
    <link rel="stylesheet" type="text/css" href="docbook-epub.css"/>
    <link rel="stylesheet" type="text/css" href="kawa.css"/>
    <script src="kawa-ebook.js" type="text/javascript"/>
    <meta name="generator" content="DocBook XSL-NS Stylesheets V1.79.1"/>
    <link rel="prev" href="Overall-Index.xhtml" title="Index"/>
    <link rel="next" href="Pretty-printing.xhtml" title="Pretty-printing"/>
  </head>
  <body>
    <header/>
    <section class="sect1" title="Formatted Output (Common-Lisp-style)" epub:type="subchapter" id="Format">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both">Formatted Output (Common-Lisp-style)</h2>
          </div>
        </div>
      </div>
      <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667872335040" class="indexterm"/> <code class="function">format</code> <em class="replaceable"><code>destination</code></em> <em class="replaceable"><code>fmt</code></em> <em class="replaceable"><code>.</code></em> <em class="replaceable"><code>arguments</code></em></p>
      <div class="blockquote">
        <blockquote class="blockquote">
          <p>An almost complete implementation of Common LISP format description
according to the CL reference book <em class="citetitle">Common LISP</em> from Guy L.
Steele, Digital Press.  Backward compatible to most of the available
Scheme format implementations.
</p>
          <p>Returns <code class="literal">#t</code>, <code class="literal">#f</code> or a string; has side effect of printing
according to <em class="replaceable"><code>fmt</code></em>.  If <em class="replaceable"><code>destination</code></em> is <code class="literal">#t</code>,
the output is to the current output port and <code class="literal">#!void</code> is returned.  If
<em class="replaceable"><code>destination</code></em> is <code class="literal">#f</code>, a formatted string is returned as the
result of the call.  If <em class="replaceable"><code>destination</code></em> is a string,
<em class="replaceable"><code>destination</code></em> is regarded as the format string; <em class="replaceable"><code>fmt</code></em> is
then the first argument and the output is returned as a string. If
<em class="replaceable"><code>destination</code></em> is a number, the output is to the current error port
if available by the implementation. Otherwise <em class="replaceable"><code>destination</code></em> must be
an output port and <code class="literal">#!void</code> is returned.
</p>
          <p><em class="replaceable"><code>fmt</code></em> must be a string or an instance of <code class="literal">gnu.text.MessageFormat</code>
or <code class="literal">java.text.MessageFormat</code>.  If <em class="replaceable"><code>fmt</code></em> is a string,
it is parsed as if by <code class="literal">parse-format</code>.
</p>
        </blockquote>
      </div>
      <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667872320640" class="indexterm"/> <code class="function">parse-format</code> <em class="replaceable"><code>format-string</code></em></p>
      <div class="blockquote">
        <blockquote class="blockquote">
          <p>Parses <code class="literal">format-string</code>, which is a string of the form of a Common LISP
format description.  Returns an instance of <code class="literal">gnu.text.ReportFormat</code>,
which can be passed to the <code class="literal">format</code> function.
</p>
        </blockquote>
      </div>
      <p>A format string passed to <code class="literal">format</code> or <code class="literal">parse-format</code>
consists of format directives (that start with ‘<code class="literal">~</code>’),
and regular characters (that are written directly to the destination).
Most of the Common Lisp (and Slib) format directives are implemented.
Neither justification, nor pretty-printing are supported yet.
</p>
      <p>Plus of course, we need documentation for <code class="literal">format</code>!
</p>
      <section class="sect2" title="Implemented CL Format Control Directives" epub:type="division" id="idm139667872312816">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Implemented CL Format Control Directives</h3>
            </div>
          </div>
        </div>
        <p>Documentation syntax: Uppercase characters represent the corresponding
control directive characters. Lowercase characters represent control
directive parameter descriptions.
</p>
        <div class="variablelist" epub:type="list">
          <a id="idm139667872311136" class="indexterm"/>
          <dl class="variablelist">
            <dt class="term"><code class="literal">~A</code>
</dt>
            <dd>
              <p>Any (print as <code class="literal">display</code> does).
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~@A</code>
</dt>
                  <dd>
                    <p>left pad.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>mincol</code></em>,<em class="replaceable"><code>colinc</code></em>,<em class="replaceable"><code>minpad</code></em>,<em class="replaceable"><code>padchar</code></em>A</code>
</dt>
                  <dd>
                    <p>full padding.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872304928" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~S</code>
</dt>
            <dd>
              <p>S-expression (print as <code class="literal">write</code> does).
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~@S</code>
</dt>
                  <dd>
                    <p>left pad.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>mincol</code></em>,<em class="replaceable"><code>colinc</code></em>,<em class="replaceable"><code>minpad</code></em>,<em class="replaceable"><code>padchar</code></em>S</code>
</dt>
                  <dd>
                    <p>full padding.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872298544" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~C</code>
</dt>
            <dd>
              <p>Character.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~@C</code>
</dt>
                  <dd>
                    <p>prints a character as the reader can understand it (i.e. <code class="literal">#\</code> prefixing).
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:C</code>
</dt>
                  <dd>
                    <p>prints a character as emacs does (eg. <code class="literal">^C</code> for ASCII 03).
</p>
                  </dd>
                </dl>
              </div>
            </dd>
          </dl>
        </div>
      </section>
      <section class="sect2" title="Formatting Integers" epub:type="division" id="idm139667872293200">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Formatting Integers</h3>
            </div>
          </div>
        </div>
        <div class="variablelist" epub:type="list">
          <a id="idm139667872292128" class="indexterm"/>
          <dl class="variablelist">
            <dt class="term"><code class="literal">~D</code>
</dt>
            <dd>
              <p>Decimal.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~@D</code>
</dt>
                  <dd>
                    <p>print number sign always.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:D</code>
</dt>
                  <dd>
                    <p>print comma separated.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>mincol</code></em>,<em class="replaceable"><code>padchar</code></em>,<em class="replaceable"><code>commachar</code></em>,<em class="replaceable"><code>commawidth</code></em>D</code>
</dt>
                  <dd>
                    <p>padding.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872285152" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~X</code>
</dt>
            <dd>
              <p>Hexadecimal.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~@X</code>
</dt>
                  <dd>
                    <p>print number sign always.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:X</code>
</dt>
                  <dd>
                    <p>print comma separated.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>mincol</code></em>,<em class="replaceable"><code>padchar</code></em>,<em class="replaceable"><code>commachar</code></em>,<em class="replaceable"><code>commawidth</code></em>X</code>
</dt>
                  <dd>
                    <p>padding.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872278272" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~O</code>
</dt>
            <dd>
              <p>Octal.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~@O</code>
</dt>
                  <dd>
                    <p>print number sign always.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:O</code>
</dt>
                  <dd>
                    <p>print comma separated.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>mincol</code></em>,<em class="replaceable"><code>padchar</code></em>,<em class="replaceable"><code>commachar</code></em>,<em class="replaceable"><code>commawidth</code></em>O</code>
</dt>
                  <dd>
                    <p>padding.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872271296" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~B</code>
</dt>
            <dd>
              <p>Binary.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~@B</code>
</dt>
                  <dd>
                    <p>print number sign always.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:B</code>
</dt>
                  <dd>
                    <p>print comma separated.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>mincol</code></em>,<em class="replaceable"><code>padchar</code></em>,<em class="replaceable"><code>commachar</code></em>,<em class="replaceable"><code>commawidth</code></em>B</code>
</dt>
                  <dd>
                    <p>padding.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872264464" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>R</code>
</dt>
            <dd>
              <p>Radix <em class="replaceable"><code>n</code></em>.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>,<em class="replaceable"><code>mincol</code></em>,<em class="replaceable"><code>padchar</code></em>,<em class="replaceable"><code>commachar</code></em>,<em class="replaceable"><code>commawidth</code></em>R</code>
</dt>
                  <dd>
                    <p>padding.
</p>
                  </dd>
                </dl>
              </div>
            </dd>
            <dt class="term"><code class="literal">~@R</code>
</dt>
            <dd>
              <p>print a number as a Roman numeral.
</p>
            </dd>
            <dt class="term"><code class="literal">~:@R</code>
</dt>
            <dd>
              <p>print a number as an “old fashioned” Roman numeral.
</p>
            </dd>
            <dt class="term"><code class="literal">~:R</code>
</dt>
            <dd>
              <p>print a number as an ordinal English number.
</p>
            </dd>
            <dt class="term"><code class="literal">~R</code>
</dt>
            <dd>
              <p>print a number as a cardinal English number.
<a id="idm139667872254160" class="indexterm"/>
</p>
            </dd>
            <dt class="term"><code class="literal">~P</code>
</dt>
            <dd>
              <p>Plural.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~@P</code>
</dt>
                  <dd>
                    <p>prints <code class="literal">y</code> and <code class="literal">ies</code>.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:P</code>
</dt>
                  <dd>
                    <p>as <code class="literal">~P but jumps 1 argument backward.</code>
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:@P</code>
</dt>
                  <dd>
                    <p>as <code class="literal">~@P but jumps 1 argument backward.</code>
</p>
                  </dd>
                </dl>
              </div>
            </dd>
          </dl>
        </div>
        <p><em class="replaceable"><code>commawidth</code></em> is the number of characters between two comma characters.
</p>
      </section>
      <section class="sect2" title="Formatting real numbers" epub:type="division" id="idm139667872246272">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Formatting real numbers</h3>
            </div>
          </div>
        </div>
        <div class="variablelist" epub:type="list">
          <a id="idm139667872245200" class="indexterm"/>
          <dl class="variablelist">
            <dt class="term"><code class="literal">~F</code>
</dt>
            <dd>
              <p>Fixed-format floating-point (prints a flonum like <em class="replaceable"><code>mmm.nnn</code></em>).
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>width</code></em>,<em class="replaceable"><code>digits</code></em>,<em class="replaceable"><code>scale</code></em>,<em class="replaceable"><code>overflowchar</code></em>,<em class="replaceable"><code>padchar</code></em>F</code>
</dt>
                  <dd/>
                  <dt class="term"><code class="literal">~@F</code>
</dt>
                  <dd>
                    <p>If the number is positive a plus sign is printed.
</p>
                  </dd>
                </dl>
              </div>
            </dd>
          </dl>
        </div>
        <div class="variablelist" epub:type="list">
          <a id="idm139667872238704" class="indexterm"/>
          <dl class="variablelist">
            <dt class="term"><code class="literal">~E</code>
</dt>
            <dd>
              <p>Exponential floating-point (prints a flonum like <em class="replaceable"><code>mmm.nnn</code></em><code class="literal">E</code><em class="replaceable"><code>ee</code></em>)
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>width</code></em>,<em class="replaceable"><code>digits</code></em>,<em class="replaceable"><code>exponentdigits</code></em>,<em class="replaceable"><code>scale</code></em>,<em class="replaceable"><code>overflowchar</code></em>,<em class="replaceable"><code>padchar</code></em>,<em class="replaceable"><code>exponentchar</code></em>E</code>
</dt>
                  <dd/>
                  <dt class="term"><code class="literal">~@E</code>
</dt>
                  <dd>
                    <p>If the number is positive a plus sign is printed.
</p>
                  </dd>
                </dl>
              </div>
            </dd>
          </dl>
        </div>
        <div class="variablelist" epub:type="list">
          <a id="idm139667872230864" class="indexterm"/>
          <dl class="variablelist">
            <dt class="term"><code class="literal">~G</code>
</dt>
            <dd>
              <p>General floating-point (prints a flonum either fixed or exponential).
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>width</code></em>,<em class="replaceable"><code>digits</code></em>,<em class="replaceable"><code>exponentdigits</code></em>,<em class="replaceable"><code>scale</code></em>,<em class="replaceable"><code>overflowchar</code></em>,<em class="replaceable"><code>padchar</code></em>,<em class="replaceable"><code>exponentchar</code></em>G</code>
</dt>
                  <dd/>
                  <dt class="term"><code class="literal">~@G</code>
</dt>
                  <dd>
                    <p>If the number is positive a plus sign is printed.
</p>
                  </dd>
                </dl>
              </div>
              <p>A slight difference from Common Lisp:  If the number is printed
in fixed form and the fraction is zero,
then a zero digit is printed for the fraction, if allowed by the <em class="replaceable"><code>width</code></em>
and <em class="replaceable"><code>digits</code></em> is unspecified.
</p>
            </dd>
          </dl>
        </div>
        <div class="variablelist" epub:type="list">
          <a id="idm139667872222448" class="indexterm"/>
          <dl class="variablelist">
            <dt class="term"><code class="literal">~$</code>
</dt>
            <dd>
              <p>Dollars floating-point (prints a flonum in fixed with signs separated).
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>digits</code></em>,<em class="replaceable"><code>scale</code></em>,<em class="replaceable"><code>width</code></em>,<em class="replaceable"><code>padchar</code></em>$</code>
</dt>
                  <dd/>
                  <dt class="term"><code class="literal">~@$</code>
</dt>
                  <dd>
                    <p>If the number is positive a plus sign is printed.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:@$</code>
</dt>
                  <dd>
                    <p>A sign is always printed and appears before the padding.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:$</code>
</dt>
                  <dd>
                    <p>The sign appears before the padding.
</p>
                  </dd>
                </dl>
              </div>
            </dd>
          </dl>
        </div>
      </section>
      <section class="sect2" title="Miscellaneous formatting operators" epub:type="division" id="idm139667872214448">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Miscellaneous formatting operators</h3>
            </div>
          </div>
        </div>
        <div class="variablelist" epub:type="list">
          <a id="idm139667872213360" class="indexterm"/>
          <dl class="variablelist">
            <dt class="term"><code class="literal">~%</code>
</dt>
            <dd>
              <p>Newline.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>%</code>
</dt>
                  <dd>
                    <p>print <em class="replaceable"><code>n</code></em> newlines.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872209568" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~&amp;</code>
</dt>
            <dd>
              <p>print newline if not at the beginning of the output line.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>&amp;</code>
</dt>
                  <dd>
                    <p>prints <code class="literal">~&amp;</code> and then <em class="replaceable"><code>n-1</code></em> newlines.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872205184" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~|</code>
</dt>
            <dd>
              <p>Page Separator.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>|</code>
</dt>
                  <dd>
                    <p>print <em class="replaceable"><code>n</code></em> page separators.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872201344" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~~</code>
</dt>
            <dd>
              <p>Tilde.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>~</code>
</dt>
                  <dd>
                    <p>print <em class="replaceable"><code>n</code></em> tildes.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872197552" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~</code>&lt;newline&gt;
</dt>
            <dd>
              <p>Continuation Line.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~:</code>&lt;newline&gt;
</dt>
                  <dd>
                    <p>newline is ignored, white space left.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~@</code>&lt;newline&gt;
</dt>
                  <dd>
                    <p>newline is left, white space ignored.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872193088" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~T</code>
</dt>
            <dd>
              <p>Tabulation.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~@T</code>
</dt>
                  <dd>
                    <p>relative tabulation.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>colnum</code></em>,<em class="replaceable"><code>colinc</code></em>T</code>
</dt>
                  <dd>
                    <p>full tabulation.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872188160" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~?</code>
</dt>
            <dd>
              <p>Indirection (expects indirect arguments as a list).
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~@?</code>
</dt>
                  <dd>
                    <p>extracts indirect arguments from format arguments.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872185056" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~(<em class="replaceable"><code>str</code></em>~)</code>
</dt>
            <dd>
              <p>Case conversion (converts by <code class="literal">string-downcase</code>).
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~:(<em class="replaceable"><code>str</code></em>~)</code>
</dt>
                  <dd>
                    <p>converts by <code class="literal">string-capitalize</code>.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~@(<em class="replaceable"><code>str</code></em>~)</code>
</dt>
                  <dd>
                    <p>converts by <code class="literal">string-capitalize-first</code>.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:@(<em class="replaceable"><code>str</code></em>~)</code>
</dt>
                  <dd>
                    <p>converts by <code class="literal">string-upcase</code>.
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872176512" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~*</code>
</dt>
            <dd>
              <p>Argument Jumping (jumps 1 argument forward).
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>*</code>
</dt>
                  <dd>
                    <p>jumps <em class="replaceable"><code>n</code></em> arguments forward.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:*</code>
</dt>
                  <dd>
                    <p>jumps 1 argument backward.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>:*</code>
</dt>
                  <dd>
                    <p>jumps <em class="replaceable"><code>n</code></em> arguments backward.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~@*</code>
</dt>
                  <dd>
                    <p>jumps to the 0th argument.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>@*</code>
</dt>
                  <dd>
                    <p>jumps to the <em class="replaceable"><code>n</code></em>th argument (beginning from 0)
</p>
                  </dd>
                </dl>
              </div>
            </dd>
            <dt class="term"><code class="literal">~[<em class="replaceable"><code>str0</code></em>~;<em class="replaceable"><code>str1</code></em>~;...~;<em class="replaceable"><code>strn</code></em>~]</code>
</dt>
            <dd>
              <p>Conditional Expression (numerical clause conditional).
</p>
              <div class="variablelist" epub:type="list">
                <a id="idm139667872164128" class="indexterm"/>
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>[</code>
</dt>
                  <dd>
                    <p>take argument from <em class="replaceable"><code>n</code></em>.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~@[</code>
</dt>
                  <dd>
                    <p>true test conditional.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:[</code>
</dt>
                  <dd>
                    <p>if-else-then conditional.
<a id="idm139667872159424" class="indexterm"/>
</p>
                  </dd>
                  <dt class="term"><code class="literal">~;</code>
</dt>
                  <dd>
                    <p>clause separator.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:;</code>
</dt>
                  <dd>
                    <p>default clause follows.
</p>
                  </dd>
                </dl>
              </div>
            </dd>
            <dt class="term"><code class="literal">~{<em class="replaceable"><code>str</code></em>~}</code>
</dt>
            <dd>
              <p>Iteration (args come from the next argument (a list)).
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>{</code>
</dt>
                  <dd>
                    <p>at most <em class="replaceable"><code>n</code></em> iterations.
<a id="idm139667872153040" class="indexterm"/>
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:{</code>
</dt>
                  <dd>
                    <p>args from next arg (a list of lists).
</p>
                  </dd>
                  <dt class="term"><code class="literal">~@{</code>
</dt>
                  <dd>
                    <p>args from the rest of arguments.
</p>
                  </dd>
                  <dt class="term"><code class="literal">~:@{</code>
</dt>
                  <dd>
                    <p>args from the rest args (lists).
</p>
                  </dd>
                </dl>
              </div>
              <a id="idm139667872148944" class="indexterm"/>
            </dd>
            <dt class="term"><code class="literal">~^</code>
</dt>
            <dd>
              <p>Up and out.
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>^</code>
</dt>
                  <dd>
                    <p>aborts if <em class="replaceable"><code>n</code></em> = 0
</p>
                  </dd>
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>,<em class="replaceable"><code>m</code></em>^</code>
</dt>
                  <dd>
                    <p>aborts if <em class="replaceable"><code>n</code></em> = <em class="replaceable"><code>m</code></em>
</p>
                  </dd>
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>,<em class="replaceable"><code>m</code></em>,<em class="replaceable"><code>k</code></em>^</code>
</dt>
                  <dd>
                    <p>aborts if <em class="replaceable"><code>n</code></em> &lt;= <em class="replaceable"><code>m</code></em> &lt;= <em class="replaceable"><code>k</code></em>
</p>
                  </dd>
                </dl>
              </div>
            </dd>
          </dl>
        </div>
      </section>
      <section class="sect2" title="Unimplemented CL Format Control Directives" epub:type="division" id="idm139667872138880">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Unimplemented CL Format Control Directives</h3>
            </div>
          </div>
        </div>
        <div class="variablelist" epub:type="list">
          <dl class="variablelist">
            <dt class="term"><code class="literal">~:A</code>
</dt>
            <dd>
              <p>print <code class="literal">#f</code> as an empty list (see below).
</p>
            </dd>
            <dt class="term"><code class="literal">~:S</code>
</dt>
            <dd>
              <p>print <code class="literal">#f</code> as an empty list (see below).
</p>
            </dd>
            <dt class="term"><code class="literal">~&lt;~&gt;</code>
</dt>
            <dd>
              <p>Justification.
</p>
            </dd>
            <dt class="term"><code class="literal">~:^</code>
</dt>
            <dd/>
          </dl>
        </div>
      </section>
      <section class="sect2" title="Extended, Replaced and Additional Control Directives" epub:type="division" id="idm139667872132720">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title">Extended, Replaced and Additional Control Directives</h3>
            </div>
          </div>
        </div>
        <p>These are not necesasrily implemented in Kawa!
</p>
        <div class="variablelist" epub:type="list">
          <dl class="variablelist">
            <dt class="term"><code class="literal">~I</code>
</dt>
            <dd>
              <p>print a R4RS complex number as <code class="literal">~F~@Fi</code> with passed parameters for
<code class="literal">~F</code>.
</p>
            </dd>
            <dt class="term"><code class="literal">~Y</code>
</dt>
            <dd>
              <p>Pretty print formatting of an argument for scheme code lists.
</p>
            </dd>
            <dt class="term"><code class="literal">~K</code>
</dt>
            <dd>
              <p>Same as <code class="literal">~?.</code>
</p>
            </dd>
            <dt class="term"><code class="literal">~!</code>
</dt>
            <dd>
              <p>Flushes the output if format <em class="replaceable"><code>destination</code></em> is a port.
</p>
            </dd>
            <dt class="term"><code class="literal">~_</code>
</dt>
            <dd>
              <p>Print a <code class="literal">#\space</code> character
</p>
              <div class="variablelist" epub:type="list">
                <dl class="variablelist">
                  <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>_</code>
</dt>
                  <dd>
                    <p>print <em class="replaceable"><code>n</code></em> <code class="literal">#\space</code> characters.
</p>
                  </dd>
                </dl>
              </div>
            </dd>
            <dt class="term"><code class="literal">~<em class="replaceable"><code>n</code></em>C</code>
</dt>
            <dd>
              <p>Takes <em class="replaceable"><code>n</code></em> as an integer representation for a character. No arguments
are consumed. <em class="replaceable"><code>n</code></em> is converted to a character by
<code class="literal">integer-&gt;char</code>.  <em class="replaceable"><code>n</code></em> must be a positive decimal number.
</p>
            </dd>
            <dt class="term"><code class="literal">~:S</code>
</dt>
            <dd>
              <p>Print out readproof.  Prints out internal objects represented as
<code class="literal">#&lt;...&gt;</code> as strings <code class="literal">"#&lt;...&gt;"</code> so that the format output can always
be processed by <code class="literal">read</code>.

</p>
            </dd>
            <dt class="term"><code class="literal">~:A</code>
</dt>
            <dd>
              <p>Print out readproof.  Prints out internal objects represented as
<code class="literal">#&lt;...&gt;</code> as strings <code class="literal">"#&lt;...&gt;"</code> so that the format output can always
be processed by <code class="literal">read</code>.

</p>
            </dd>
            <dt class="term"><code class="literal">~F, ~E, ~G, ~$</code>
</dt>
            <dd>
              <p>may also print number strings, i.e. passing a number as a string and
format it accordingly.
</p>
            </dd>
          </dl>
        </div>
      </section>
    </section>
    <footer>
      <div class="navfooter">
        <ul>
          <li>
            <b class="toc">
              <a href="Format.xhtml#idm139667872312816">Implemented CL Format Control Directives</a>
            </b>
          </li>
          <li>
            <b class="toc">
              <a href="Format.xhtml#idm139667872293200">Formatting Integers</a>
            </b>
          </li>
          <li>
            <b class="toc">
              <a href="Format.xhtml#idm139667872246272">Formatting real numbers</a>
            </b>
          </li>
          <li>
            <b class="toc">
              <a href="Format.xhtml#idm139667872214448">Miscellaneous formatting operators</a>
            </b>
          </li>
          <li>
            <b class="toc">
              <a href="Format.xhtml#idm139667872138880">Unimplemented CL Format Control Directives</a>
            </b>
          </li>
          <li>
            <b class="toc">
              <a href="Format.xhtml#idm139667872132720">Extended, Replaced and Additional Control Directives</a>
            </b>
          </li>
        </ul>
        <p>
          Up: <a accesskey="u" href="Input-Output.xhtml">Input, output, and file handling</a></p>
        <p>
        Previous: <a accesskey="p" href="Ports.xhtml">Ports</a></p>
        <p>
        Next: <a accesskey="n" href="Pretty-printing.xhtml">Pretty-printing</a></p>
      </div>
    </footer>
  </body>
</html>
